package com.home.security.browser.shiro;

import com.home.security.core.enums.LoginTypeEnum;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;

/**
 * Description: 重写 doCredentialsMatch, 实现免密码登录
 * Created by 王大宸 on 2020-11-14 2:02
 * Created with IntelliJ IDEA.
 */
public class MyRetryLimitCredentialsMatcher extends HashedCredentialsMatcher {

    @Override
    public boolean doCredentialsMatch(AuthenticationToken authcToken, AuthenticationInfo info) {
        AuthToken tk = (AuthToken) authcToken;
        if (tk.getType().equals(LoginTypeEnum.NO_PASSWORD)) {
            return true;
        }
        return super.doCredentialsMatch(authcToken, info);
    }

}
